import { fetch, mock } from 'api'
// 查询总数
let _once = (uid) => {
  return fetch(
    'GetTotalCustForType',
    {
      UnionID: uid
    }
  )
}
// 列表
let _list = opt => {
  let {
    UnionID,
    KeyWord,
    TotalType,
    StateType,
    PageIndex,
    PageSize
  } = opt
  return fetch(
    'GetMyCustomerForSale',
    {
      UnionID,
      KeyWord,
      TotalType,
      StateType,
      PageIndex,
      PageSize
    }
  )
}
// 详单
let _detail = id => {
  return fetch(
    'GetCustomerInfo',
    {
      ID: id
    }
  )
}
// 销售员接单
let _accept = (UnionID, CustomerID) => {
  return fetch(
    'ReceiveOrders',
    {
      UnionID,
      CustomerID
    }
  )
}
// 销售经理派单
let _dispatch = (UnionID, CustomerID, SaleStaffID, ProjectID) => {
  return fetch(
    'ParcelSaleUser',
    {
      UnionID,
      CustomerID,
      SaleStaffID,
      ProjectID
    }
  )
}
// 修改状态
const _modify = (UnionID, ID, Events, Remark) => fetch(
  'ChangeLogState',
  {
    UnionID,
    ID,
    Events,
    Remark
  }
)
export {
  _once,
  _list,
  _detail,
  _accept,
  _dispatch,
  _modify
}